
/*
 * Copyright 2002-2020 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2020原作者。
 *
 *根据Apache许可证2.0版（“许可证”）许可；
 *除非符合许可证的规定，否则您不得使用此文件。
 *您可以在以下网址获取许可证副本
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，否则软件
 *根据许可证分发是在“按原样”的基础上分发的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限的特定语言，请参阅许可证
 *许可证下的限制。
 */

package org.springframework.context.annotation;

import java.util.function.Predicate;

import org.springframework.core.type.AnnotationMetadata;
import org.springframework.lang.Nullable;

/**
 * Interface to be implemented by types that determine which @{@link Configuration}
 * class(es) should be imported based on a given selection criteria, usually one or
 * more annotation attributes.
 *
 * <p>An {@link ImportSelector} may implement any of the following
 * {@link org.springframework.beans.factory.Aware Aware} interfaces,
 * and their respective methods will be called prior to {@link #selectImports}:
 * <ul>
 * <li>{@link org.springframework.context.EnvironmentAware EnvironmentAware}</li>
 * <li>{@link org.springframework.beans.factory.BeanFactoryAware BeanFactoryAware}</li>
 * <li>{@link org.springframework.beans.factory.BeanClassLoaderAware BeanClassLoaderAware}</li>
 * <li>{@link org.springframework.context.ResourceLoaderAware ResourceLoaderAware}</li>
 * </ul>
 *
 * <p>Alternatively, the class may provide a single constructor with one or more of
 * the following supported parameter types:
 * <ul>
 * <li>{@link org.springframework.core.env.Environment Environment}</li>
 * <li>{@link org.springframework.beans.factory.BeanFactory BeanFactory}</li>
 * <li>{@link java.lang.ClassLoader ClassLoader}</li>
 * <li>{@link org.springframework.core.io.ResourceLoader ResourceLoader}</li>
 * </ul>
 *
 * <p>{@code ImportSelector} implementations are usually processed in the same way
 * as regular {@code @Import} annotations, however, it is also possible to defer
 * selection of imports until all {@code @Configuration} classes have been processed
 * (see {@link DeferredImportSelector} for details).
 *
 * @author Chris Beams
 * @author Juergen Hoeller
 * @since 3.1
 * @see DeferredImportSelector
 * @see Import
 * @see ImportBeanDefinitionRegistrar
 * @see Configuration
 */
/**
 *要由类型实现的接口，这些类型决定哪个@｛@link配置｝
 *类应该基于给定的选择标准导入，通常是一个或
 *更多注释属性。
 *
 *＜p＞｛@link ImportSelector｝可以实现以下任何一个
 *｛@link org.springframework.beans.factory.Aware Aware｝接口，
 *并且它们各自的方法将在{@link#selectImports}之前被调用：
 *＜ul＞
 *<li>｛@link org.springframework.context.EnvironmentAware环境感知｝</li>
 *＜li＞｛@link org.springframework.beans.factory.BeanFactory软件BeanFactory软件｝</li>
 *<li>｛@link org.springframework.beans.factory.BeanClassLoaderAware BeanClassLoader Aware｝</li>
 *<li>｛@link org.springframework.context.ResourceLoaderAware资源加载器Aware｝</li>
 *</ul>
 *
 *<p>或者，类可以提供一个具有以下一个或多个的构造函数
 *以下支持的参数类型：
 *＜ul＞
 *＜li＞｛@link org.springframework.core.env.env.Environment环境｝</li>
 *＜li＞｛@link org.springframework.beans.factory.BeanFactory BeanFactory｝</li>
 *＜li＞｛@link java.lang.ClassLoader类加载器｝</li>
 *＜li＞｛@link org.springframework.core.io.ResourceLoader资源加载器｝</li>
 *</ul>
 *
 *＜p＞｛@code ImportSelector｝实现通常以相同的方式处理
 *然而，作为常规的{@code@Import}注释，也可以推迟
 *选择导入，直到处理完所有｛@code@Configuration｝类
 *（有关详细信息，请参阅｛@link DeferredImportSelector｝）。
 *
 *@作者Chris Beams
 *@作者Juergen Hoeller
 *@自3.1起
 *@请参阅DeferredImportSelector
 *@请参阅导入
 *@see ImportBeanDefinition注册器
 *@请参阅配置
 */
public interface ImportSelector {

	/**
	 * Select and return the names of which class(es) should be imported based on
	 * the {@link AnnotationMetadata} of the importing @{@link Configuration} class.
	 * @return the class names, or an empty array if none
	 */
	/**
	 *选择并返回应导入的类的名称
	 *导入@｛@link Configuration｝类的｛@linkAnnotationMetadata｝。
	 *@返回类名，如果没有，则返回空数组
	 */
	String[] selectImports(AnnotationMetadata importingClassMetadata);

	/**
	 * Return a predicate for excluding classes from the import candidates, to be
	 * transitively applied to all classes found through this selector's imports.
	 * <p>If this predicate returns {@code true} for a given fully-qualified
	 * class name, said class will not be considered as an imported configuration
	 * class, bypassing class file loading as well as metadata introspection.
	 * @return the filter predicate for fully-qualified candidate class names
	 * of transitively imported configuration classes, or {@code null} if none
	 * @since 5.2.4
	 */
	/**
	 *返回用于从导入候选中排除类的谓词
	 *可转换地应用于通过该选择器的导入找到的所有类。
	 *＜p＞如果此谓词为给定的完全限定返回｛@code true｝
	 *类名，所述类不会被视为导入的配置
	 *类，绕过类文件加载以及元数据自省。
	 *@为完全限定的候选类名返回筛选谓词
	 *传递导入的配置类的个数，如果没有则为｛@code null｝
	 *@自5.2.4起
	 */
	@Nullable
	default Predicate<String> getExclusionFilter() {
		return null;
	}

}
